"""
APP 配置
"""
import urllib
from sqlalchemy.pool import QueuePool
from framework.the_path import ThePath

ENV = 'development'
HOST = '0.0.0.0'
PORT = 9091
DEBUG = True
# 新项目使用  python -c 'import os; print(os.urandom(16))' 生成SECRET_KEY
SECRET_KEY = b'e\xa8n\xcf\xc3\xc9\xd9Y\xb1\xdd\xe4B\x95Xh\xeb'
SEND_FILE_MAX_AGE_DEFAULT = 43200

# 数据库配置
# SQLALCHEMY_DATABASE_URI = 'mysql://electricity:X1w4G3Hdl7VCNqhs@36.110.47.24:3317/electricity_data_test'
SQLALCHEMY_DATABASE_URI = 'mysql://electricity_api_service:GJlfh7&#jg@mmservice-05.mysql.hotgrid.cn:3306/electricity_data'
SQLALCHEMY_BINDS = {
     'olympic_db': f'mysql://olympic:{urllib.parse.quote("olympic_ysrd@2021")}@rm-2zem57smz83811158bo.mysql.rds.aliyuncs.com:3306/olympic_db',
     'ysrd_y': 'mysql://weiyanjie:ysrd_PASSW0RD_2023@ysrd_y_master.mysql.internal.airqualitychina.cn:3317/ysrd_y',
               'elec_db_2': 'mysql://electricity_api_service:GJlfh7&#jg@mmservice-05.mysql.hotgrid.cn:3306/electricity_data',

}
SQLALCHEMY_ECHO = True
SQLALCHEMY_TRACK_MODIFICATIONS = False
SQLALCHEMY_RECORD_QUERIES = True
SQLALCHEMY_ENGINE_OPTIONS = {
    'connect_args': {
        # 解决 sqlite3 线程报错问题
        # 'check_same_thread':False
    },
    'echo_pool': True,
    'poolclass': QueuePool,
    'pool_pre_ping': True,
    'pool_size': 20,
    'pool_recycle': 300,
    'pool_timeout': 5
}
_API_NICE_RESP=False

REDIS_HOST = 'electricity-service.redis.hotgrid.cn'
REDIS_PORT = 6379
REDIS_PWD = 'phWOgP05ymg01GaR'
REDIS_DB = 2
